Finally, to complete the dollar value extraction, we use str_extract_currencies and join it back into the data frame. Lastly, we convert it into ‘wide’ format.
Admittedly, this is a little ‘hacky’ so I’d be happy for any feedback to improve this process.
We input the constraints via matrix form where the rows correspond to individual constraints and the columns correspond to elements of the objective function.
You can see this only provides the solution to the objective equation. This isn’t interesting, because it should be the sum of all the prizes since our constrains limit us to selecting each prize once.
This provides the solution vector with 1s for the location of each prize in the objective equation. With a little massaging, we can understand this better